// Copyright 2011 Jefferson Willian
// willmont7@gmail.com

#include <cstdio>

#define MAX 101
#define INF 10000

int main() {
  int villages[MAX][MAX+1];
  int in[2];
  int higher, lower;
  int n;
  int games = 1;
  int i, j, k;

  while (scanf("%d", &n) && n != 0) {
    for (int i = 1;i <= n;i++) {
      for (int j = 1;j <= n;j++)
        villages[i][j] = INF;
      villages[i][i] = 0;
    }

    for (int i = 0;i < n-1;i++) {
      scanf("%d%d", &in[0], &in[1]);
      villages[in[0]][in[1]] = 1;
      villages[in[1]][in[0]] = 1;
    }

    /* Floyd-Marshall - Algoritmo de caminho minimo */
    for (int i = 1;i <= n;i++)
      for (int j = 1;j <= n;j++)
        for (int k = 1;k <= n;k++)
          if (villages[j][i]+villages[i][k] < villages[j][k])
            villages[j][k] = villages[j][i]+villages[i][k];

    for (int i = 1;i <= n;i++) {
      higher = 1;
      /* Verifica a vila mais longe de 'i' */
      for (int j = 2;j <= n;j++)
          if (villages[i][j] > villages[i][higher])
            higher = j;
      /* Armazena a distancia da vila mais longe na posicao 101 da linha 'i' */
      villages[i][101] = villages[i][higher];
    }

    lower = 1;

    /* Verifica a menor distancia das distancias mais longas */
    for (int i = 2;i <= n;i++)
      if (villages[i][101] < villages[lower][101])
        lower = i;

    printf("Teste %d\n%d\n\n", games++, lower);
  }

  return 0;
}
